package sicau.practice.community.Controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import sicau.practice.community.Mapper.UserMapper;
import sicau.practice.community.model.Realuser;
import sicau.practice.community.model.User;

import java.util.List;

@RestController
public class testController {
    @Autowired
    UserMapper userMapper;



    @GetMapping("/login")
    public String login(String username,String password){
        List<Realuser> list= userMapper.login(username,password);
        if (list!=null){
            return "登录成功";
        }
        return "账号密码错误";
    }


    @RequestMapping("/listUser")
    public String listCategory(){
        User user = new User();
        user.setAccountId("123");
        user.setName("副团长");
        userMapper.insert(user);
        return "first-index";
    }
}
